package com.jadeen.controller.clientController;

import com.jadeen.common.controller.BaseController;
import com.jadeen.common.domain.AjaxResult;
import com.jadeen.entity.domain.Category;
import com.jadeen.enums.StatusEnum;
import com.jadeen.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 资源分类Controller
 * 
 * @author jadeen
 * @date 2025-08-12
 */
@RestController
@RequestMapping("/client/share/category")
public class ClientCategoryController extends BaseController
{
    @Autowired
    private ICategoryService categoryService;

    /**
     * 查询资源分类列表
     */
    @GetMapping("/list")
    public AjaxResult list(Category category)
    {
        category.setStatus(StatusEnum.ON.getCode());
        List<Category> list = categoryService.selectCategoryList(category);
        return success(list);
    }


    /**
     * 获取资源分类详细信息
     */
    @GetMapping(value = "/{categoryId}")
    public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId)
    {
        return success(categoryService.selectCategoryByCategoryId(categoryId));
    }
}
